﻿
namespace Indeco.G24.Windows.Forms
{
	/// <summary>
	/// abstract QuanLyFile typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class QuanLyFileDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<QuanLyFileDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.QuanLyFile _currentQuanLyFile = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxQuanLyFileDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxQuanLyFileErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxQuanLyFileBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the IDQuanLyFile property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDQuanLyFileDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDNguoiDung property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDNguoiDungDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThuMucLuuTru property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThuMucLuuTruDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TenFileGoc property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTenFileGocDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TenFileTrenServer property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTenFileTrenServerDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DungLuong property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDungLuongDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the KieuFile property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKieuFileDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TrangThai property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxTrangThaiDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Khoa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxKhoaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SoLanDownLoad property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSoLanDownLoadDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemCapNhat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemCapNhatDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.NguoiDung> _IDNguoiDungList;
		
		/// <summary> 
		/// The list of selectable NguoiDung
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.NguoiDung> IDNguoiDungList
		{
			get {return this._IDNguoiDungList;}
			set 
			{
				this._IDNguoiDungList = value;
				this.uxIDNguoiDungDataGridViewColumn.DataSource = null;
				this.uxIDNguoiDungDataGridViewColumn.DataSource = this._IDNguoiDungList;
			}
		}
		
		private bool _allowNewItemInIDNguoiDungList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of NguoiDung
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDNguoiDungList
		{
			get { return _allowNewItemInIDNguoiDungList;}
			set
			{
				this._allowNewItemInIDNguoiDungList = value;
				this.uxIDNguoiDungDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.QuanLyFile> _QuanLyFileList;
				
		/// <summary> 
		/// The list of QuanLyFile to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.QuanLyFile> QuanLyFileList
		{
			get {return this._QuanLyFileList;}
			set
			{
				this._QuanLyFileList = value;
				this.uxQuanLyFileBindingSource.DataSource = null;
				this.uxQuanLyFileBindingSource.DataSource = value;
				this.uxQuanLyFileDataGridView.DataSource = null;
				this.uxQuanLyFileDataGridView.DataSource = this.uxQuanLyFileBindingSource;				
				//this.uxQuanLyFileBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxQuanLyFileBindingSource_ListChanged);
				this.uxQuanLyFileBindingSource.CurrentItemChanged += new System.EventHandler(OnQuanLyFileBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnQuanLyFileBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentQuanLyFile = uxQuanLyFileBindingSource.Current as Entities.QuanLyFile;
			
			if (_currentQuanLyFile != null)
			{
				_currentQuanLyFile.Validate();
			}
			//_QuanLyFile.Validate();
			OnCurrentEntityChanged();
		}

		//void uxQuanLyFileBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.QuanLyFile"/> instance.
		/// </summary>
		public Entities.QuanLyFile SelectedQuanLyFile
		{
			get {return this._currentQuanLyFile;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxQuanLyFileDataGridView.VirtualMode;}
			set
			{
				this.uxQuanLyFileDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxQuanLyFileDataGridView.AllowUserToAddRows;}
			set {this.uxQuanLyFileDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxQuanLyFileDataGridView.AllowUserToDeleteRows;}
			set {this.uxQuanLyFileDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxQuanLyFileDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxQuanLyFileDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="QuanLyFileDataGridViewBase"/> class.
		/// </summary>
		public QuanLyFileDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxQuanLyFileDataGridView = new System.Windows.Forms.DataGridView();
			this.uxQuanLyFileBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxQuanLyFileErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDQuanLyFileDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDNguoiDungDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxThuMucLuuTruDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTenFileGocDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTenFileTrenServerDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDungLuongDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKieuFileDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTrangThaiDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxKhoaDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxSoLanDownLoadDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemCapNhatDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDNguoiDungBindingSource = new NguoiDungBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDNguoiDungBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxQuanLyFileDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxQuanLyFileBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxQuanLyFileErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxQuanLyFileErrorProvider
			// 
			this.uxQuanLyFileErrorProvider.ContainerControl = this;
			this.uxQuanLyFileErrorProvider.DataSource = this.uxQuanLyFileBindingSource;						
			// 
			// uxQuanLyFileDataGridView
			// 
			this.uxQuanLyFileDataGridView.AutoGenerateColumns = false;
			this.uxQuanLyFileDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxQuanLyFileDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDQuanLyFileDataGridViewColumn,
		this.uxIDNguoiDungDataGridViewColumn,
		this.uxThuMucLuuTruDataGridViewColumn,
		this.uxTenFileGocDataGridViewColumn,
		this.uxTenFileTrenServerDataGridViewColumn,
		this.uxDungLuongDataGridViewColumn,
		this.uxKieuFileDataGridViewColumn,
		this.uxTrangThaiDataGridViewColumn,
		this.uxKhoaDataGridViewColumn,
		this.uxSoLanDownLoadDataGridViewColumn,
		this.uxThoiDiemCapNhatDataGridViewColumn			});
			this.uxQuanLyFileDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxQuanLyFileDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxQuanLyFileDataGridView.Name = "uxQuanLyFileDataGridView";
			this.uxQuanLyFileDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxQuanLyFileDataGridView.TabIndex = 0;	
			this.uxQuanLyFileDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxQuanLyFileDataGridView.EnableHeadersVisualStyles = false;
			this.uxQuanLyFileDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnQuanLyFileDataGridViewDataError);
			this.uxQuanLyFileDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnQuanLyFileDataGridViewCellValueNeeded);
			this.uxQuanLyFileDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnQuanLyFileDataGridViewCellValuePushed);
			
			//
			// uxIDQuanLyFileDataGridViewColumn
			//
			this.uxIDQuanLyFileDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDQuanLyFileDataGridViewColumn.DataPropertyName = "IDQuanLyFile";
			this.uxIDQuanLyFileDataGridViewColumn.HeaderText = "IDQuanLyFile";
			this.uxIDQuanLyFileDataGridViewColumn.Name = "uxIDQuanLyFileDataGridViewColumn";
			this.uxIDQuanLyFileDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDQuanLyFileDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDQuanLyFileDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDNguoiDungDataGridViewColumn
			//
			this.uxIDNguoiDungDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDNguoiDungDataGridViewColumn.DataPropertyName = "IDNguoiDung";
			this.uxIDNguoiDungDataGridViewColumn.HeaderText = "IDNguoiDung";
			this.uxIDNguoiDungDataGridViewColumn.Name = "uxIDNguoiDungDataGridViewColumn";
			this.uxIDNguoiDungDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDNguoiDungDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDNguoiDungDataGridViewColumn.ReadOnly = false;		
			//
			// uxThuMucLuuTruDataGridViewColumn
			//
			this.uxThuMucLuuTruDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThuMucLuuTruDataGridViewColumn.DataPropertyName = "ThuMucLuuTru";
			this.uxThuMucLuuTruDataGridViewColumn.HeaderText = "ThuMucLuuTru";
			this.uxThuMucLuuTruDataGridViewColumn.Name = "uxThuMucLuuTruDataGridViewColumn";
			this.uxThuMucLuuTruDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThuMucLuuTruDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThuMucLuuTruDataGridViewColumn.ReadOnly = false;		
			//
			// uxTenFileGocDataGridViewColumn
			//
			this.uxTenFileGocDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTenFileGocDataGridViewColumn.DataPropertyName = "TenFileGoc";
			this.uxTenFileGocDataGridViewColumn.HeaderText = "TenFileGoc";
			this.uxTenFileGocDataGridViewColumn.Name = "uxTenFileGocDataGridViewColumn";
			this.uxTenFileGocDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTenFileGocDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTenFileGocDataGridViewColumn.ReadOnly = false;		
			//
			// uxTenFileTrenServerDataGridViewColumn
			//
			this.uxTenFileTrenServerDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTenFileTrenServerDataGridViewColumn.DataPropertyName = "TenFileTrenServer";
			this.uxTenFileTrenServerDataGridViewColumn.HeaderText = "TenFileTrenServer";
			this.uxTenFileTrenServerDataGridViewColumn.Name = "uxTenFileTrenServerDataGridViewColumn";
			this.uxTenFileTrenServerDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTenFileTrenServerDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTenFileTrenServerDataGridViewColumn.ReadOnly = false;		
			//
			// uxDungLuongDataGridViewColumn
			//
			this.uxDungLuongDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDungLuongDataGridViewColumn.DataPropertyName = "DungLuong";
			this.uxDungLuongDataGridViewColumn.HeaderText = "DungLuong";
			this.uxDungLuongDataGridViewColumn.Name = "uxDungLuongDataGridViewColumn";
			this.uxDungLuongDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDungLuongDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDungLuongDataGridViewColumn.ReadOnly = false;		
			//
			// uxKieuFileDataGridViewColumn
			//
			this.uxKieuFileDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKieuFileDataGridViewColumn.DataPropertyName = "KieuFile";
			this.uxKieuFileDataGridViewColumn.HeaderText = "KieuFile";
			this.uxKieuFileDataGridViewColumn.Name = "uxKieuFileDataGridViewColumn";
			this.uxKieuFileDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKieuFileDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKieuFileDataGridViewColumn.ReadOnly = false;		
			//
			// uxTrangThaiDataGridViewColumn
			//
			this.uxTrangThaiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTrangThaiDataGridViewColumn.DataPropertyName = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.HeaderText = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.Name = "uxTrangThaiDataGridViewColumn";
			this.uxTrangThaiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTrangThaiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTrangThaiDataGridViewColumn.ReadOnly = false;		
			//
			// uxKhoaDataGridViewColumn
			//
			this.uxKhoaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKhoaDataGridViewColumn.DataPropertyName = "Khoa";
			this.uxKhoaDataGridViewColumn.HeaderText = "Khoa";
			this.uxKhoaDataGridViewColumn.Name = "uxKhoaDataGridViewColumn";
			this.uxKhoaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKhoaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKhoaDataGridViewColumn.ReadOnly = false;		
			//
			// uxSoLanDownLoadDataGridViewColumn
			//
			this.uxSoLanDownLoadDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSoLanDownLoadDataGridViewColumn.DataPropertyName = "SoLanDownLoad";
			this.uxSoLanDownLoadDataGridViewColumn.HeaderText = "SoLanDownLoad";
			this.uxSoLanDownLoadDataGridViewColumn.Name = "uxSoLanDownLoadDataGridViewColumn";
			this.uxSoLanDownLoadDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSoLanDownLoadDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSoLanDownLoadDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemCapNhatDataGridViewColumn
			//
			this.uxThoiDiemCapNhatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemCapNhatDataGridViewColumn.DataPropertyName = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.HeaderText = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.Name = "uxThoiDiemCapNhatDataGridViewColumn";
			this.uxThoiDiemCapNhatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemCapNhatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemCapNhatDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDNguoiDungDataGridViewColumn
			//				
			this.uxIDNguoiDungDataGridViewColumn.DisplayMember = "TenSuDung";	
			this.uxIDNguoiDungDataGridViewColumn.ValueMember = "IDNguoiDung";	
			this.uxIDNguoiDungDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDNguoiDungDataGridViewColumn.DataSource = uxIDNguoiDungBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxQuanLyFileDataGridView);
			this.Name = "QuanLyFileDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDNguoiDungBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxQuanLyFileErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxQuanLyFileDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxQuanLyFileBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				QuanLyFileDataGridViewEventArgs args = new QuanLyFileDataGridViewEventArgs();
				args.QuanLyFile = _currentQuanLyFile;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class QuanLyFileDataGridViewEventArgs : System.EventArgs
		{
			private Entities.QuanLyFile	_QuanLyFile;
	
			/// <summary>
			/// the  Entities.QuanLyFile instance.
			/// </summary>
			public Entities.QuanLyFile QuanLyFile
			{
				get { return _QuanLyFile; }
				set { _QuanLyFile = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxQuanLyFileDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnQuanLyFileDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxQuanLyFileDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnQuanLyFileDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxQuanLyFileDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDQuanLyFileDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].IDQuanLyFile;
						break;
					case "uxIDNguoiDungDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].IDNguoiDung;
						break;
					case "uxThuMucLuuTruDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].ThuMucLuuTru;
						break;
					case "uxTenFileGocDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].TenFileGoc;
						break;
					case "uxTenFileTrenServerDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].TenFileTrenServer;
						break;
					case "uxDungLuongDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].DungLuong;
						break;
					case "uxKieuFileDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].KieuFile;
						break;
					case "uxTrangThaiDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].TrangThai;
						break;
					case "uxKhoaDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].Khoa;
						break;
					case "uxSoLanDownLoadDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].SoLanDownLoad;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						e.Value = QuanLyFileList[e.RowIndex].ThoiDiemCapNhat;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxQuanLyFileDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnQuanLyFileDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxQuanLyFileDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDQuanLyFileDataGridViewColumn":
						QuanLyFileList[e.RowIndex].IDQuanLyFile = (System.Guid)e.Value;
						break;
					case "uxIDNguoiDungDataGridViewColumn":
						QuanLyFileList[e.RowIndex].IDNguoiDung = (System.Guid)e.Value;
						break;
					case "uxThuMucLuuTruDataGridViewColumn":
						QuanLyFileList[e.RowIndex].ThuMucLuuTru = (System.String)e.Value;
						break;
					case "uxTenFileGocDataGridViewColumn":
						QuanLyFileList[e.RowIndex].TenFileGoc = (System.String)e.Value;
						break;
					case "uxTenFileTrenServerDataGridViewColumn":
						QuanLyFileList[e.RowIndex].TenFileTrenServer = (System.String)e.Value;
						break;
					case "uxDungLuongDataGridViewColumn":
						QuanLyFileList[e.RowIndex].DungLuong = (System.Int64)e.Value;
						break;
					case "uxKieuFileDataGridViewColumn":
						QuanLyFileList[e.RowIndex].KieuFile = (System.String)e.Value;
						break;
					case "uxTrangThaiDataGridViewColumn":
						QuanLyFileList[e.RowIndex].TrangThai = (System.Boolean)e.Value;
						break;
					case "uxKhoaDataGridViewColumn":
						QuanLyFileList[e.RowIndex].Khoa = (System.Boolean)e.Value;
						break;
					case "uxSoLanDownLoadDataGridViewColumn":
						QuanLyFileList[e.RowIndex].SoLanDownLoad = (System.Int64)e.Value;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						QuanLyFileList[e.RowIndex].ThoiDiemCapNhat = (System.DateTime)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
